<!DOCTYPE html>
<html>
	<head>
	    <meta charset="UTF-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
	    <title>教师管理</title>
		<include file='Layout:ins_css' />
	        <style type="text/css">
	            #addBtn {
	                float: right;
	                margin: -7px -6px 9px;
	            }
	            #exportBtn{
	            	float: right;
	            	margin: -7px 10px 9px;
	            	
	            }
	            .price-div {
	                /*float: left;*/
	                margin: 12px 0px 6px 16px;
	            }
	
	            .price-div input {
	                width: 60%;
	               /* float: left;*/
	                margin-right: 6px;
	            }
	
	            .price-div p {
	                line-height: 25px;
	                margin-right: 6px;
	                float: left;
	            }
	
	            .price-div select {
	                /*float: left;*/
	                width: 60%;
                    max-width: 16em;
	                margin-right: 10px;
	            }
	            .price-div table{
	               width: 100%;	
	            }
	            .cyf-form-group{
	                margin-top: 10px;
	                margin-bottom: 10px;
	
	            }
	            .select2-drop {
	                z-index: 10050 !important;
	            }
	
	            .select2-search-choice-close {
	                margin-top: 0 !important;
	                right: 2px !important;
	                min-height: 10px;
	            }
	            .select2-search-choice-close:before {
	                color: black !important;
	            }
	            /*防止select2不会自动失去焦点*/
	
	            .select2-container {
	                z-index: 16000 !important;
	            }
	
	            .select2-drop-mask {
	                z-index: 15990 !important;
	            }
	
	            .select2-drop-active {
	                z-index: 15995 !important;
	            }
	
	            .staff {
	                margin-top: 6px;
	            }
	            .nationality {
	                margin-right: 15px;
	            }
	            div.dataTables_filter label input{
	                width: 100%;
	            }
	            .noun-label{
                    font-size: 15px;
                }
	
	        </style>
	</head>
	<body>
		<div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-xs-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title" style="display: block;">
                            <h5>教师管理</h5>
                           	<button class="btn btn-primary" id="addBtn">新增</button>
                           	<!--<button class="btn btn-info" id="exportBtn">批量导入学生</button>-->
                        </div>
                        <div class="row s-row">
                            <div class="col-xs-12">
                                <div class="price-div">
                                    <form class="form-horizontal">
                                        <div class="form-group cyf-form-group">
                                            <div class="col-sm-4" style="margin-top: 10px; margin-bottom: 10px">
                                                <label style="float: left" class="col-sm-4 control-label cvbnm">学院: </label>
                                                <select class="form-control col-sm-" id="college_id" name="college_id" style="min-height: 35px">
                                                    <option value="0">全部</option>
                                                    <volist name="college_info" id="college_info">
                                                        <option value="{$college_info.sch_id}">{$college_info.sch_name}</option>
                                                    </volist>
                                                </select>
                                            </div>
                                            <div class="col-sm-4" style="margin-top: 10px; margin-bottom: 10px">
                                                <label style="float: left; " class="col-sm-4 control-label cvbnm">系部: </label>
                                                <select class="form-control col-sm-" id="department_id" name="department_id" style="min-height: 35px">
                                                    <option value="0">全部</option>
                                                    <volist name="department_info" id="department_info">
                                                        <option value="{$department_info.dept_id}" pid="{$department_info.sch_id}"  style="display: none;">{$department_info.dept_name}</option>
                                                    </volist>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group cyf-form-group">
                                        	<div class="col-sm-4" style="margin-top: 10px; margin-bottom: 10px">
                                                <label style="float: left;" class="col-sm-4 control-label cvbnm">职工号: </label>
                                                <input type="text" id="find_tea_number" name="find_tea_number" class="form-control" style="min-height: 30px"/>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="ibox-content">
                        	<table class="table s-table table-striped table-bordered table-hover dataTables-example">
                                <thead>
	                                <tr>
	                                    <th width="12%">职工号</th>
	                                    <th width="12%">姓名</th>
	                                    <th width="12%">职称</th>
	                                    <th width="12%">性别</th>
	                                    <th width="12%">出生日期</th>
	                                    <th width="12%">状态</th>
	                                    <th width="18%">操作</th>
	                                </tr>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- Modal 新增教师-->
        <div class="modal fade" id="AdNoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">新增教师</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal" id="form_add">
                            <div class="form-group">
                                <label class="col-sm-3 control-label cvbnm nationality">所属学院</label>
                                <select class="form-control poiu" id="sd_boss_add" name="sd_boss_add">
                                    <option value="0">请选择</option>
                                    <volist name="par_college" id="par_college">
                                        <option value="{$par_college.sch_id}">{$par_college.sch_name}</option>
                                    </volist>
                                </select>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label cvbnm nationality">所属系部</label>
                                <select class="form-control poiu" id="de_boss_add" name="de_boss_add">
                                    <option value="0">请选择</option>
                                    <volist name="par_department" id="par_department">
                                        <option value="{$par_department.dept_id}" pid="{$par_department.sch_id}" class="p_department_id" style="display: none;">{$par_department.dept_name}</option>
                                    </volist>
                                </select>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label ">职工号</label>
                                <div class="col-sm-7">
                                    <input type="text" id="add_teacher_id" name="add_teacher_id" class="form-control removeData">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">姓名</label>
                                <div class="col-sm-7">
                                    <input type="text" id="add_teacher_name" name="add_teacher_name" class="form-control removeData">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">职称</label>
                                <div class="col-sm-7">
                                    <select class="form-control" id="add_teacher_zhi" name="add_teacher_zhi" style="padding: 4px 12px;">
                                    	<option value="0">请选择</option>
	                                    <option value="1">教授</option>
	                                    <option value="2">副教授</option>
	                                    <option value="3">讲师</option>
	                                    <option value="4">助教</option>
	                                </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">性别</label>
                                <div class="col-sm-7">
                                	<select class="form-control" id="add_teacher_sex" name="add_teacher_sex" style="padding: 4px 12px;">
                                		<option value="0">请选择</option>
	                                    <option value="1">男</option>
	                                    <option value="2">女</option>
                                	</select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">出生日期</label>
                                <div class="col-sm-7">
                                	<input id="add_teacher_birthday" name="add_teacher_birthday" readonly="readonly" class="laydate-icon form-control layer-date" style="max-width: 100%;" >
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">状态</label>
                                <div class="col-sm-7">
                                	<select class="form-control" id="add_teacher_status" name="add_teacher_status" style="padding: 4px 12px;">
                                        <option value="0">请选择</option>
                                        <option value="1">在职</option>
                                        <option value="2">离职</option>
                                        <option value="3">退休</option>
                                	</select>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" id="add_btn">保存</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- Modal 编辑专业-->
        <div class="modal fade" id="EditNoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title">编辑教师</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal" id="form_edit">
                            <div class="form-group">
                                <label class="col-sm-3 control-label cvbnm nationality">所属学院</label>
                                <select class="form-control poiu" id="sd_boss_edit" name="sd_boss_edit">
                                    <option value="0">请选择</option>
                                    <volist name="par_college_edit" id="par_college_edit">
                                        <option value="{$par_college_edit.sch_id}">{$par_college_edit.sch_name}</option>
                                    </volist>
                                </select>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label cvbnm nationality">所属系部</label>
                                <select class="form-control poiu" id="de_boss_edit" name="de_boss_edit">
                                    <option value="0">请选择</option>
                                    <volist name="par_department_edit" id="par_department_edit">
                                        <option value="{$par_department_edit.dept_id}">{$par_department_edit.dept_name}</option>
                                    </volist>
                                </select>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label ">职工号</label>
                                <div class="col-sm-7">
                                    <input type="text" id="edit_teacher_id" name="edit_teacher_id" class="form-control removeData">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">姓名</label>
                                <div class="col-sm-7">
                                    <input type="text" id="edit_teacher_name" name="edit_teacher_name" class="form-control removeData">
                                </div>
                            </div>
                             <div class="form-group">
                                <label class="col-sm-3 control-label">职称</label>
                                <div class="col-sm-7">
                                    <select class="form-control" id="edit_teacher_zhi" name="edit_teacher_zhi" style="padding: 4px 12px;">
                                    	<option value="0">请选择</option>
	                                    <option value="1">教授</option>
	                                    <option value="2">副教授</option>
	                                    <option value="3">讲师</option>
	                                    <option value="4">助教</option>
	                                </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">性别</label>
                                <div class="col-sm-7">
                                	<select class="form-control" id="edit_teacher_sex" name="edit_teacher_sex" style="padding: 4px 12px;">
                                		<option value="0">请选择</option>
	                                    <option value="1">男</option>
	                                    <option value="2">女</option>
                                	</select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">出生日期</label>
                                <div class="col-sm-7">
                                	<input id="edit_teacher_birthday" name="edit_teacher_birthday" readonly="readonly" class="laydate-icon form-control layer-date" style="max-width: 100%;">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">状态</label>
                                <div class="col-sm-7">
                                	<select class="form-control" id="edit_teacher_status" name="edit_teacher_status" style="padding: 4px 12px;">
                                		<option value="0">请选择</option>
	                                    <option value="1">在职</option>
	                                    <option value="2">离职</option>
	                                    <option value="3">退休</option>
	                                </select>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" id="edit_btn">保存</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- 权限模态框 -->
        <div class="modal fade" id="NounModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" style="width: 70%" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title">教师权限</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal" id="">
                            <div class="form-group" style="margin-top: 3%">
                                <label class="col-sm-2 control-label noun-label">院系: </label>
                                <div class="col-sm-5">
                                    <input type="text" readonly="readonly" id="noun_yuanxi" name="noun_yuanxi" class="form-control removeData">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label noun-label">姓名: </label>
                                <div class="col-sm-5">
                                    <input type="text" readonly="readonly" id="noun_name" name="noun_name" class="form-control removeData">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label noun-label" style="margin-bottom: 5%">账号: </label>
                                <div class="col-sm-5">
                                    <input type="text" readonly="readonly" id="noun_account" name="noun_account" class="form-control removeData">
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-6">
                                    <div class="ibox float-e-margins">
                                        <div class="ibox-title" style="display: block;">
                                            <h5>课程列表</h5>
                                            <!--<button class="btn btn-primary" id="addBtn">新增</button>-->
                                            <!--<button class="btn btn-info" id="exportBtn">批量导入学生</button>-->
                                        </div>
                                        <div class="ibox-content">
                                            <table class="table nc-table table-striped table-bordered table-hover dataTables-example">
                                                <thead>
                                                    <tr>
                                                        <th width="60%">课程</th>
                                                        <th width="40%">操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xs-6">
                                    <div class="ibox float-e-margins">
                                        <div class="ibox-title" style="display: block;">
                                            <h5>已有权限</h5>
                                            <!--<button class="btn btn-primary" id="addBtn">新增</button>-->
                                            <!--<button class="btn btn-info" id="exportBtn">批量导入学生</button>-->
                                        </div>
                                        <div class="ibox-content">
                                            <table class="table noun-table table-striped table-bordered table-hover dataTables-example">
                                                <thead>
                                                <tr>
                                                    <th width="60%">课程</th>
                                                    <th width="40%">操作</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" id="">保存</button>
                    </div>
                </div>
            </div>
        </div>
        <include file='Layout:ins_js' />
        <script src="__JS__/plugins/layer/laydate/laydate.js"></script>
        <script type="text/javascript">
            course_dept_id = '';
            teacher_id = '';
            $(document).ready(function() {
                //自检
                check_index();

                sTable = $(".s-table").DataTable({
                    "fnServerParams": function(aoData) {
                        aoData.push({
                            'name': 'department_id',
                            'value': $('select#department_id option:selected').val()
                        },{
                        	'name': 'tea_num',
                        	'value': $('#find_tea_number').val()
                        });
                    },
                    "bAutoWidth":false,
                    "oLanguage": {
                        "sLengthMenu": "每页 _MENU_ ",
                        "sProcessing": "处理中...",
                        "sZeroRecords": "没有匹配结果",
                        "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
                        "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
                        "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
                        "sInfoPostFix": "",
                        "sSearch": "搜索:",
                        "sUrl": "",
                        "sEmptyTable": "表中数据为空",
                        "sLoadingRecords": "载入中...",
                        "sInfoThousands": ",",
                        "oPaginate": {
                            "sFirst": "首页",
                            "sPrevious": "上页",
                            "sNext": "下页",
                            "sLast": "末页"
                        },
                        "oAria": {
                            "sSortAscending": ": 以升序排列此列",
                            "sSortDescending": ": 以降序排列此列"
                        }
                    },
                    "sAjaxSource": "__URL__/teacher_manage_ShowDatatables", //调用php后台接口方法地址
                    "aoColumns": [{
                        'data': 'tea_id'
                    },{
                        'data': 'tea_name'
                    },{
                        'data': 'tea_zhi'
                    },{
                        'data': 'tea_sex'
                    },{
                        'data': 'tea_bir'
                    },{
                    	'data': 'tea_status'
                    },{
                        "data": null,
                        orderable: false,
                        render: function(data, type, row, meta) {
                            return '<a type="button" class="btn btn-success" href="#" onclick=editnoun(this) >权限</a>|<a type="button" class="btn btn-success" href="#" onclick=editFromID(this) >编辑</a>|<a type="button" class="btn btn-danger" href="#" onclick=delFromID(this) >删除</a>'
                        }
                    }]
                });
                cTable = $(".nc-table").DataTable({
                    "fnServerParams": function(aoData) {
                        aoData.push({
                            'name': 'department_id',
                            'value': course_dept_id
                        },{
                            'name': 'tea_id',
                            'value': teacher_id
                        });
                    },
                    "bAutoWidth":false,
                    "oLanguage": {
                        "sLengthMenu": "每页 _MENU_ ",
                        "sProcessing": "处理中...",
                        "sZeroRecords": "没有匹配结果",
                        "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
                        "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
                        "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
                        "sInfoPostFix": "",
                        "sSearch": "搜索:",
                        "sUrl": "",
                        "sEmptyTable": "表中数据为空",
                        "sLoadingRecords": "载入中...",
                        "sInfoThousands": ",",
                        "oPaginate": {
                            "sFirst": "首页",
                            "sPrevious": "上页",
                            "sNext": "下页",
                            "sLast": "末页"
                        },
                        "oAria": {
                            "sSortAscending": ": 以升序排列此列",
                            "sSortDescending": ": 以降序排列此列"
                        }
                    },
                    "sAjaxSource": "__URL__/course_info_ShowDatatables", //调用php后台接口方法地址
                    "aoColumns": [{
                        'data': 'name'
                    },{
                        "data": null,
                        orderable: false,
                        render: function(data, type, row, meta) {
                            return '<a type="button" class="btn btn-success" href="#"  onclick=addNoun(this) >+</a>'
                        }
                    }]
                });
                nTable = $(".noun-table").DataTable({
                    "fnServerParams": function(aoData) {
                        aoData.push({
                            'name': 'teacher_id',
                            'value': teacher_id
                        });
                    },
                    "bAutoWidth":false,
                    "oLanguage": {
                        "sLengthMenu": "每页 _MENU_ ",
                        "sProcessing": "处理中...",
                        "sZeroRecords": "没有匹配结果",
                        "sInfo": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
                        "sInfoEmpty": "显示第 0 至 0 项结果，共 0 项",
                        "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
                        "sInfoPostFix": "",
                        "sSearch": "搜索:",
                        "sUrl": "",
                        "sEmptyTable": "表中数据为空",
                        "sLoadingRecords": "载入中...",
                        "sInfoThousands": ",",
                        "oPaginate": {
                            "sFirst": "首页",
                            "sPrevious": "上页",
                            "sNext": "下页",
                            "sLast": "末页"
                        },
                        "oAria": {
                            "sSortAscending": ": 以升序排列此列",
                            "sSortDescending": ": 以降序排列此列"
                        }
                    },
                    "sAjaxSource": "__URL__/teacher_course_ShowDatatables", //调用php后台接口方法地址
                    "aoColumns": [{
                        'data': 'name'
                    },{
                        "data": null,
                        orderable: false,
                        render: function(data, type, row, meta) {
                            return '<a type="button" class="btn btn-danger" href="#"  onclick=deleteNoun(this) >—</a>'
                        }
                    }]
                });

				//外部js调用
			    laydate({
			        elem: '#add_teacher_birthday', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			            event: 'focus' //响应事件。如果没有传入event，则按照默认的click
			    });
				laydate({
			        elem: '#edit_teacher_birthday', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
			            event: 'focus' //响应事件。如果没有传入event，则按照默认的click
			    });
            });
            //查询按钮
            $("select#college_id").change(function() {
                //console.log( $('select#college_id option:selected').val());
                var p_id = $("#college_id").val();
                $("#department_id option").hide();
                $('#department_id').val('0');
                $('option[pid=' + p_id + ']').show();
            });
            $("select#department_id").change(function() {
                //console.log( $('select#college_id option:selected').val());
               sTable.ajax.reload();
            });
           	$("#find_tea_number").bind("input propertychange chang",function(){
            	sTable.ajax.reload();
            });
            <!--------------   新增模态框相关     !----------------->
            //新增模态框 - 学院 选择事件-
            $('select#sd_boss_add').change(function () {
                var p_id = $("#sd_boss_add").val();
                $("#de_boss_add option").hide();
                $('#de_boss_add').val('0');
                $('#de_boss_add option[pid=' + p_id + ']').show();
            });
            //新增模态框弹出
            $("#addBtn").on('click', function() {
                $("#AdNoModal").modal();
            });
            $("#add_btn").on('click', function() {
                var formData = $('#form_add').serializeArray();
                var postData = {};

                $(formData).each(function(i) {
                    postData[this.name] = this.value;
                });
                sil_loading();
                $.ajax({
                    type: "post",
                    url: "__URL__/add_teacher",
                    async: true,
                    data: postData,
                    dataType: 'json',
                    success: function(p) {
                        if(p.state) {
                            toastr.success(p.info);
                            $("#AdNoModal").modal('hide');
                            sTable.ajax.reload();
                        } else {
                            toastr.warning(p.info);
                        }
                        sil_reloading();
                    }
                });
            });
            <!--------------   编辑模态框相关     !----------------->
            //编辑模态框弹出
            function editFromID(obj) {
                var Obj = $(obj).parent().parent();
                var rowdata = sTable.row(Obj).data();
                $('#sd_boss_edit').val(rowdata.sch_id);
                $('#de_boss_edit').val(rowdata.dept_id);
                $('#edit_teacher_id').val(rowdata.tea_id);
                $('#edit_teacher_name').val(rowdata.tea_name);
                selectByText('edit_teacher_zhi',rowdata.tea_zhi);
                // $("#edit_teacher_sex option:contains('rowdata.tea_zhi')").attr("selected", true);
                selectByText('edit_teacher_sex',rowdata.tea_zhi);
                selectByText('edit_teacher_status',rowdata.tea_status);
                $('#edit_teacher_birthday').val(rowdata.tea_bir);
                $("#EditNoModal").modal();
            }
            $("#edit_btn").on('click', function() {
                var formData = $('#form_edit').serializeArray();
                var postData = {};

                $(formData).each(function(i) {
                    postData[this.name] = this.value;
                });
                sil_loading();
                $.ajax({
                    type: "post",
                    url: "__URL__/edit_teacher",
                    async: true,
                    data: postData,
                    dataType: 'json',
                    success: function(p) {
                        if(p.state) {
                            toastr.success(p.info);
                            $("#EditNoModal").modal('hide');
                            sTable.ajax.reload();
                        } else {
                            toastr.warning(p.info);
                        }
                        sil_reloading();
                    }
                });
            });
            function delFromID(obj) {
                var Obj = $(obj).parent().parent();
                var rowdata = sTable.row(Obj).data();
                swal({
                    title: '提示',
                    text: "确定要删除吗?",
                    type: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    confirmButtonText: '确定',
                    cancelButtonText: '取消'
                }).then(function(isConfirm) {
                    if(isConfirm) {
                        $.ajax({
                            type: "post",
                            url: "__URL__/delete_teacher",
                            async: true,
                            data: {
                                delete_teacher_id: rowdata.tea_id,
                            },
                            dataType: 'json',
                            success: function(p) {
                                toastr.success(p.info);
                                sTable.ajax.reload();
                            }
                        })
                    }
                });
            }

            <!--------------   权限模态框相关     !----------------->
            //权限模态框弹出
            function editnoun(obj) {
                var teaObj = $(obj).parent().parent();
                var rowdata = sTable.row(teaObj).data();
                if(rowdata.tea_manager != 0){
                    course_dept_id = rowdata.dept_id;
                    teacher_id = rowdata.tea_id;
                    getCoAndDeName(rowdata.dept_id);
                    $('#noun_name').val(rowdata.tea_name);
                    $('#noun_account').val(rowdata.tea_id);
                    cTable.ajax.reload();
                    nTable.ajax.reload();
                    $('#NounModal').modal();
                }else {
                    toastr.error("该教师是教务人员，没有教授课程职能");
                }
            }
            function addNoun(obj) {
                var Obj = $(obj).parent().parent();
                var rowdata = cTable.row(Obj).data();
                $.ajax({
                    type: "post",
                    url: "__URL__/addTeacherCourseNoun",
                    async: true,
                    data: {
                        'department_id': rowdata.id,
                        'teacher_id' : teacher_id
                    },
                    dataType: 'json',
                    success: function(c) {
                        if(c.state == true) {
//                            return ;
                            cTable.ajax.reload();
                            nTable.ajax.reload();
                        } else {

                        }
                    }
                });

            }
            function deleteNoun(obj){
                var Obj = $(obj).parent().parent();
                var rowdata = nTable.row(Obj).data();
                $.ajax({
                    type: "post",
                    url: "__URL__/deleteTeacherCourseNoun",
                    async: true,
                    data: {
                        'department_id': rowdata.cou_id,
                        'teacher_id' : rowdata.tea_id
                    },
                    dataType: 'json',
                    success: function(c) {
                        if(c.state == true) {
//                            return ;
                            cTable.ajax.reload();
                            nTable.ajax.reload();
                        } else {

                        }
                    }
                });
            }

            //销毁模态框
            $(".modal").on("hidden.bs.modal", function() {
                $('.removeData').val('');
                $(".wrapper").addClass('animated');
            });

            //public function
            function getCoAndDeName(id) {
                $.ajax({
                    type: "post",
                    url: "__URL__/getCollegeAndDepartmentName",
                    async: true,
                    data: {
                        department_id: id,
                    },
                    dataType: 'json',
                    success: function(c) {
                        if(c.state == true) {
//                            return ;
                            $('#noun_yuanxi').val(c.info['sch_name']+ c.info['dept_name']);
                        } else {
                            $('#noun_yuanxi').val('');
                        }
                    }
                });
            }
        </script>
	</body>
</html>